package com.lsu.proxy.homework;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Java动态代理
 *
 * @Author wang suo
 * @Date 2020/12/28 0028 11:15
 * @Version 1.0
 */
public class ProxyFunction implements InvocationHandler {
    private SaleComputer computerMaker;

    ProxyFunction(SaleComputer computerMaker) {
        this.computerMaker = computerMaker;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object res = method.invoke(computerMaker, args);
        System.out.println("ProxyFunction：我TM直接中间商赚差价+100元");
        return res;
    }
}
